package com.situ.day10;

public class ThreadDemo {
	public static void main1(String[] args) {
		MyRunnable myRunnable = new MyRunnable();
		MyThread myThread = new MyThread();
		Thread thread1 = new Thread(myRunnable);
		Thread thread2 = new Thread(myThread);
		thread1.start();
		thread2.start();

		String name = Thread.currentThread().getName();
		for (int i = 0; i < 100; i++) {
			System.out.println(name + ":" + i);
		}
	}

	public static void main5(String[] args) {
		OddThread oddThread = new OddThread("奇数线程");
		EvenThread evenThread = new EvenThread("偶数线程");
		oddThread.start();
		evenThread.start();
	}

	public static void main(String[] args) {
		OddRunnable oddRunnable = new OddRunnable();
		Thread oddThread = new Thread(oddRunnable, "奇数线程");
		oddThread.start();
		EvenRunnable evenRunnable = new EvenRunnable();
		Thread evenThread = new Thread(evenRunnable, "偶数线程");
		evenThread.start();
	}
}
